<extend name="Public:template" />
<block name="page_header">
	<ul class="header-sub">
		<li class="previous"><a href="#" class="btn btn-default active" role="button" onClick="javascript:window.history.back(-1);return false;"><span class="icon icon-chevron-left"></span>返回</a></li>
		<li ><h3>订单详细</h3></li>
		<li class="next "><a href="{:U('OrderManage/showMyList',array('order_status'=>$orderDetail['order_status']))}" class="btn btn-warning active" role="button">列表<span class="icon-white icon-file"></span></a></li>	</ul>
</block>
<block name="page_body">
<ul class="list-group mt5">
	<li class="list-group-item blueGraBg mt5"  action_url="{:U('CustOrder/showDetail',array('order_code'=>$val['order_code']))}">
		<h2 class="list-group-item-text"><span class="icon-white icon-file"></span>订单详情</h2>
	</li>
	<li class="list-group-item">
		<p>【下单时间】：{$orderDetail.cust_order_time|date="Y-m-d H:i",###}</p>
		<p>【订单号码】：{$orderDetail.order_code}</p>
		<p>【订单状态】：{$orderDetail.order_status|m_order_status}</p>
		<p>【联系方式】：{$orderDetail.cust_name}，{$orderDetail.cust_mobile}</p>
		<p>【配送地址】：{$orderDetail.cust_address}</p>
		<p>【订单总额】：	
			<span>
				<span class="deepRed">¥{$orderDetail.order_amt|number_format=###, 2,'.',''}</span>
				<if condition="$orderDetail['order_send_fee'] neq 0">
					(含¥{$orderDetail['order_send_fee']|number_format=###, 2,'.',''}运费)
				<else/>
					(免运费)
				</if>
			</span>
		</p>
	<li>
</ul>

<ul class="list-group mt5">
	<li class="list-group-item yellowGraBg">
		<h2 class="list-group-item-text"><span class="icon-white icon-th-list"></span>商品清单</h2>
	<li>
	<volist name="orderItems" id="val">
	<li class="list-group-item">
		<div class="row clearfix">
			<div class="col-xs-8 col-sm-8">{$i}.{$val.prod_name} {$val.prod_spec|m_prod_spec=$val['prod_spec_qty'],$val['prod_spec_unit']}</div>
			<div class="col-xs-2 col-sm-2"><span  class="pull-right">¥{$val.prod_price_real}</span></div>
			<div class="col-xs-2 col-sm-2"><span class="btn-warning pull-right" style="border-radius:10px;padding:1px 3px;">×{$val.prod_num}</span></div>
		</div>
	</li>
	</volist>
</ul>
<div class="alert alert-info">
	<switch name="orderDetail.order_status" >
		<case value="1">新订单，等待配货打包</case>
		<case value="2">打包中，等待配送</case>
		<case value="3">配送中，等待支付</case>
		<case value="4">支付完，等待结单</case>
		<case value="0">已结单</case>
		<default />订单状态不正常，请联系管理员
	</switch>
	<switch name="orderDetail.cust_order_status" >
		<case value="1">，已部分退货</case>
		<case value="2">，已全部退货</case>
		<case value="3">，订单已取消</case>
	<default />
	</switch>
</div>
<form name="form_edit" id="form_edit" action="{:U('showDetail')}" method="post" class="table_form_box">
   	<input type="hidden" name="order_code" value="{$orderDetail.order_code}">
   	<input type="hidden" name="upd_time" value="{$orderDetail.upd_time}">
   	<input type="hidden" name="cust_order_status" value="">
	
	<if condition="$orderDetail['order_status']==1">
	<div class="input-group  mt5">
		<div class="input-group-addon btn btn-warning active">选择打包员</div>
		<select name="shop_saler" id="shop_saler" class="form-control">
			<volist name="users" id='val'>
				<option value="{$val.id},{$val.name},{$val.mobile}">{$val.name}</option>
			</volist>
			<option value="0,其他,其他">其他</option>
		</select>
		</div>
		<a href="#" onclick="readyPackage()" class="btn btn-warning btn-block active default mt5" >开始打包</a>
	</if>
	<if condition="$orderDetail['order_status']==2">
	<div class="input-group  mt5">
		<div class="input-group-addon alert-success">选择配送员</div>
		<select name="shop_sender" id="shop_sender" class="form-control">
			<volist name="users" id='val'>
				<option value="{$val.id},{$val.name},{$val.mobile}">{$val.name}</option>
			</volist>
			<option value="0,其他,其他">其他</option>
		</select>
	</div>
	<a href="#" onclick="readySend()" class="btn btn-success btn-block active default mt5" >开始配送</a>
	</if>
	<if condition="$orderDetail['order_status']==3">
		<a href="#" onclick="readyPay('0','全额支付')" class="btn btn-danger btn-block active" role="button">全额支付</a>
		<div class="row mt15">
			<div class="col-xs-3 col-sm-3"><a href="#" onclick="readyPay('1','部分退货')" class="btn btn-default btn-block active" role="button">部分退货</a></div>
			<div class="col-xs-6 col-sm-6"></div>
			<div class="col-xs-3 col-sm-3"><a href="#" onclick="readyPay('2','全部退货')" class="btn btn-default btn-block active" role="button">全部退货</a></div>
		</div>
	</if>	
</form>
</block>
<block name="script_footer">
<script type="text/javascript">
//商品打包
function readyPackage(){
	var formObj = document.forms['form_edit'];
	var elsObj = formObj.elements;
	formObj.action = "{:U('Order/OrderManage/doReadyPackage')}";
	formObj.submit();
}
//商品配送
function readySend(){
	var formObj = document.forms['form_edit'];
	var elsObj = formObj.elements;
	formObj.action = "{:U('Order/OrderManage/doReadySend')}";
	formObj.submit();
}
//订单支付
function readyPay(cust_order_status,cust_order_status_text){
	if(confirm("确定对该订单执行：【"+cust_order_status_text+"】？")){
		var formObj = document.forms['form_edit'];
		var elsObj = formObj.elements;
		elsObj['cust_order_status'].value = cust_order_status;
		formObj.action = "{:U('Order/OrderManage/doReadyPay')}";
		formObj.submit();
	}
}
</script>
</block>